#!/bin/bash

#File:stop_elasticsearch.sh(原创)
 
 # execute elasticsearch stop finash
pid=`pgrep elasticsearch`
pid=`echo "$pid" | awk '{gsub(/ /,"")}1'`
if [ ! -n "$pid" ] || [ ! $pid ] || [ "$pid" = "" ]; then
    echo -e "elasticsearch already stoped "
    exit 0
fi
 
# execute stop elasticsearch
echo -e "kill -9 $pid"
kill -9 $pid

echo -e "Stop elasticsearch completed"
